<?php
if(empty($dataProvider->data[0]->tyre->page_title))
	$this->pageTitle = Yii::app()->name . ' - Каталог - Шины - '.CHtml::encode($dataProvider->data[0]->tyre->producer->title).' - '.CHtml::encode($dataProvider->data[0]->tyre->title);
else
	$this->pageTitle = $dataProvider->data[0]->tyre->page_title;
	
Yii::app()->clientScript->registerMetaTag($dataProvider->data[0]->tyre->page_description, 'description');
Yii::app()->clientScript->registerMetaTag($dataProvider->data[0]->tyre->page_keywords, 'keywords');

$this->breadcrumbs=array(
	'Шины'=>array('tyres/index'),
	$dataProvider->data[0]->tyre->producer->title => array('tyres/index', 'aliasProducer'=>$dataProvider->data[0]->tyre->producer->alias),
	$dataProvider->data[0]->tyre->title,
);
?>

<div class='grid_12 alpha omega catalog-card'>

	<p class='line'>
	<?php 
	$this->widget('zii.widgets.CBreadcrumbs', array(
		'links'=>$this->breadcrumbs,
		'separator'=>' <span>/</span> ',
		'htmlOptions'=>array('class'=>'left', 'id'=>'breadcrumbs'),
		'homeLink'=>false,
		'tagName'=>'span',
		'encodeLabel'=>false,
	));
	?>
	</p>

	<div class='grid_2 alpha'>
		<?php 
		$small = Image::getFile($dataProvider->data[0]->tyre->photo, 'small');
		$small = CHtml::image($small, 'Шина '.CHtml::encode($dataProvider->data[0]->tyre->producer->title.' '.$dataProvider->data[0]->tyre->title));
		if($big = Image::getFile($dataProvider->data[0]->tyre->photo, 'big'))
			echo CHtml::link( $small, $big, array('class'=>'fancybox', 'title'=>'Шина '.CHtml::encode($dataProvider->data[0]->tyre->producer->title.' '.$dataProvider->data[0]->tyre->title)) );
		else
			echo $small;
		?>
	</div>
	<div class='grid_10 omega item'>
		<h3><?php echo CHtml::encode($dataProvider->data[0]->tyre->producer->title.' '.$dataProvider->data[0]->tyre->title); ?></h3>	
	
	<?php 
	
	$sizes = $this->widget('zii.widgets.grid.CGridView', array(
		'dataProvider'=>$dataProvider,
		#'cssFile' => false,
		'summaryText'=>false,
		'ajaxUpdate'=>false,
		'enableSorting'=>false,
		#'enablePagination'=>false,
		'columns' => array(
			array(
				'name'=>'size',
				'type'=>'raw',
				'value'=>'CHtml::link($data->size, array("tyres/index", "aliasProducer"=>$data->tyre->producer->alias, "aliasModel"=>$data->tyre->alias, "aliasSize"=>$data->alias), array("title"=>$data->tyre->producer->title." ".$data->tyre->title." ".$data->size))',
			),
			array(
				'name'=>'rest',
				'value'=>'$data->rest>=4?"Больше 4":"Уточняйте у менеджера"',
				'cssClassExpression'=>'$data->rest>=4?"lot":"few"',
			),

			array(
				'name'=>'price',
				'type'=>'html',
				'value'=>'$data->price>0?number_format($data->price, 2, ",", " ")." <i class=\"rub\">Р</i>":"*"',
			),
			array(
				'name' => '',
				'type'=>'raw',
				'value' => 'Yii::app()->controller->widget("widgets.shopping.buy", array( "model"=>$data ), true)',
			)
		)
	), true);
	$comments = $this->widget('widgets.comments.comments', array(
			'model'=>$model,
		), true);
	
	$this->widget('zii.widgets.jui.CJuiTabs', array(
	    'tabs'=>array(
	        'Цены и наличие'=>$sizes,
	        'Описание шины'=> '<div class=\'description\'>'.$dataProvider->data[0]->tyre->description_marked.'</div>',
			'Отзывы'=>$comments,
	    ),
	    // additional javascript options for the tabs plugin
	    'options'=>array(
	        'collapsible'=>true,
	    ),
	));
?>
	
	
		
		<?php
		/* 
		$this->widget('widgets.socials.socials', array( 'model'=>$model, 'options'=>array(
			'title' => $model->title,
			'url' => CHtml::normalizeUrl(array('articles/view', 'alias'=>$model->alias)),
			'description' => CHtml::encode($model->description),
			'printUrl' => CHtml::normalizeUrl(array('articles/print', 'alias'=>$model->alias)),
		)));
		*/ ?>
	</div>
	
	<hr class='space clear' />

</div>

<div class='clear'></div>

<div class='grid_12 alpha'>
	<?php $this->widget('widgets.new.WNewTyres'); ?>
</div>
<div class='clear'></div>
